#ifndef _IMAGE_MANAGER_H
#define _IMAGE_MANAGER_H

#include <vector>
#include <SFML/graphics.hpp>
#include "app.h"


// struct ImageMeta
//  - A struct for storing the metadata of images
struct ImageMeta
{
	std::string filename;
};

// class ImageManager
//   - This class manages images for SFML.
//   - Images are stored in a static vector.
//	 - The first item of the images vector is a placeholder in case of errors
class ImageManager
{

private:
	// std::vector<sf::Image*> images;
	//  - This vector stores the pointers to images
	//      This takes less memory and is required for the images to be properly displayed
	//      using SFML
	std::vector<sf::Image*> images;
	
	// std::vector<ImageMeta> images_meta;
	//  - This vector stores the metadata of the images
	//  - The metadata is stored in the struct ImageMeta
	std::vector<ImageMeta> images_meta;
	
public:
	// Default constructor
	ImageManager();
	
	// Default destructor
	~ImageManager();
	
	// function set_image()
	//  - Loads an image from a file and push back on std::vector<sf::Image> images
	//  - Returns true if load succeeds, false if load fails
	bool set_image(const std::string filename);
	
	// function get_image()
	//  - Fetches an image stored in the vector based on the filename
	//  - Returns a pointer to the image
	sf::Image* get_image(const std::string filename) const;
};

#endif